<?php
require ('../include/init.inc.php');
extract ( $_REQUEST );

if (Common::isPost ()) {

		$existCard = "";
		$list = explode("\r\n", $content);
		foreach ($list as $key => $value) {
			$tmp = explode(",", $value);
			$input_data = array ('card_no' => $tmp[0], 
								'card_type' => $tmp[1],
								'operator'=>$tmp[2],
								'channel'=>$tmp[3],
								'dead_time'=>$tmp[4]);
			$card = Card::getCardBySim($tmp[0]);
			if (!$card) {
				$module_id = Card::addCard ( $input_data );
			} else {
				$existCard = $existCard.$card["card_no"]."<br/>";
			}
		}

		if (strlen($existCard)==0) {
			SysLog::addLog ( UserSession::getUserName(), 'MODIFY', 'Module' ,$module_id, json_encode($update_data) );
			Common::exitWithSuccess ('更新完成','panel/sms.php');
		} else {
			// OSAdmin::alert("error");
		}
		$existCard = "已存在的卡号是<br/>:".$existCard;
	
}

Template::assign ( 'existCard', $existCard );
Template::assign ( 'module', $module );
Template::assign ( 'view', $view );
Template::display ( 'panel/sms_input.tpl' );